import { createRouter, createWebHashHistory } from "vue-router";
const routes = [
  {
    path: "/",
    meta: { title: "" },
    component: () => import("@/views/index.vue")
  },
  {
    path: "/:pathMatch(.*)*",
    name: "notFound",
    meta: {
      title: "找不到网页"
    },
    component: () => import("../views/notFound/index.vue")
  }
];
const router = createRouter({
  history: createWebHashHistory(appConfigObj.VITE_NAME),
  routes
});
router.beforeEach(async (to, from) => {
  // const store = useAllStore();
  if (to.meta.title) {
    document.title = to.meta.title as string;
  }
  // if (to.path === "/login") {
  //   return true;
  // } else {
  //   return store.token ? true : "/login";
  // }
});
export default router;
